package com.superc.notebook.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HorizontalSplitPanel;
import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.cellview.client.CellList;
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.Cell.Context;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment;
import com.google.gwt.user.client.ui.TextBoxBase;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.TabBar;
import com.google.gwt.user.client.ui.DecoratedTabPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class NotebookBrowser implements EntryPoint {
	public void onModuleLoad() {
		RootPanel rootPanel = RootPanel.get();
		
		Grid grid = new Grid(2, 1);
		rootPanel.add(grid);
		grid.setSize("100%", "100%");
		
		HorizontalPanel horizontalPanel = new HorizontalPanel();
		horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
		grid.setWidget(0, 0, horizontalPanel);
		grid.getCellFormatter().setHeight(0, 0, "30px");
		grid.getCellFormatter().setWidth(0, 0, "100%");
		
		Label label = new Label("输入查询内容");
		horizontalPanel.add(label);
		horizontalPanel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_CENTER);
		
		TextBox textBox = new TextBox();
		horizontalPanel.add(textBox);
		
		Button button = new Button("New button");
		button.setText("查询");
		horizontalPanel.add(button);
		
		HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
		grid.setWidget(1, 0, horizontalSplitPanel);
		
		CellTable<Object> cellTable = new CellTable<Object>();
		horizontalSplitPanel.setRightWidget(cellTable);
		cellTable.setSize("100%", "100%");
		
		DecoratedTabPanel decoratedTabPanel = new DecoratedTabPanel();
		horizontalSplitPanel.setLeftWidget(decoratedTabPanel);
		decoratedTabPanel.setSize("100%", "100%");
		
		Tree tree = new Tree();
		decoratedTabPanel.add(tree, "类别视图", false);
		tree.setSize("5cm", "3cm");
		
		TreeItem treeItem = new TreeItem("New item");
		tree.addItem(treeItem);
		
		Tree tree_1 = new Tree();
		decoratedTabPanel.add(tree_1, "日历视图", false);
		tree_1.setSize("5cm", "3cm");
		
		TreeItem treeItem_1 = new TreeItem("New item");
		tree_1.addItem(treeItem_1);
		grid.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
		grid.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
	}
}
